package com.library.management.dto;

import lombok.Data;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Pattern;

/**
 * 创建用户的参数DTO
 */
@Data
@ApiModel(description = "创建用户参数")
public class UserCreateDTO {
    
    @NotBlank(message = "用户名不能为空")
    @ApiModelProperty(value = "用户名", required = true, example = "zhangsan")
    private String username;
    
    @NotBlank(message = "密码不能为空")
    @ApiModelProperty(value = "密码", required = true, example = "123456")
    private String password;
    
    @NotBlank(message = "角色不能为空")
    @Pattern(regexp = "^(admin|user)$", message = "角色只能是admin或user")
    @ApiModelProperty(value = "用户角色", required = true, example = "user", allowableValues = "admin,user")
    private String role;
} 